package cn.fl.pbl.controller;

import cmm.mid.core.framework.page.ListPageVO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.pbl.service.IPblBillDService;
import cn.fl.pbl.vo.PblBillDVO;
import fl.pbl.facade.pbl.condition.PblBillDQC;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description: 垫款贷账单详情 控制层
 */
@Controller
@RequestMapping("/pbl/pblBillD")
public class PblBillDController extends BaseController  {

	private static final Logger logger = LoggerFactory.getLogger(PblBillDController.class);
	@Autowired
	private IPblBillDService iPblBillDService;
	
	/**
	 * 初始化列表
	 */
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initPblBillDList(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.newLogger("列表页面数据").setLogOperType(LogOperEnum.REQ).setKeys("initPblBillDList",this.getRequestParameter(request),CurrentThreadContext.getCurrentUserName()).info();
		PblBillDQC qc = new PblBillDQC();
        String billId = request.getParameter("billId");
        if (StringUtils.isNotBlank(billId)) {
            qc.setPblId(Long.valueOf(billId));
        }
        qc.setIsDel(BaseConstant.IS_YESNO_NO);
        qc.setSortName("PAY_PD");
        qc.setSortOrder("ASC");
		List<PblBillDVO> list = this.iPblBillDService.searchList(qc);
		ListPageVO<PblBillDVO> listPage = new ListPageVO<PblBillDVO>(list, list.size());
		return listPage;
	}
}
